<?php
session_start();
if(empty($_SESSION["id"])) header("Location:index.php");

include("/inc/producto.class.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<!--  Version: Multiflex-3 Update-7 / Layout-3             -->
<!--  Date:    January 15, 2007                            -->
<!--  Author:  Wolfgang                                    -->
<!--  License: Fully open source without restrictions.     -->
<!--           Please keep footer credits with a link to   -->
<!--           Wolfgang (www.1-2-3-4.info). Thank you!     -->

<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="cache-control" content="no-cache" />
  <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout3_setup.css" />
  <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout3_text.css" />
  <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/slideshow.css" />
  <script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {		
	
	//Execute the slideShow
	slideShow();

});

function slideShow() {

	//Set the opacity of all images to 0
	$('#gallery a').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#gallery a:first').css({opacity: 1.0});
	
	//Set the caption background to semi-transparent
	$('#gallery .caption').css({opacity: 0.7});

	//Resize the width of the caption according to the image width
	$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
	
	//Get the caption of the first image from REL attribute and display it
	$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
	.animate({opacity: 0.7}, 400);
	
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery()',6000);
	
}

function gallery() {
	
	//if no IMGs have the show class, grab the first image
	var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	//Set the opacity to 0 and height to 1px
	$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
	
	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	$('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '100px'},500 );
	
	//Display the content
	$('#gallery .content').html(caption);
	
	
}

</script>
  <title>GiveAway</title>
</head>

<!-- Global IE fix to avoid layout crash when single word size wider than column width -->
<!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]-->

<body>
  <!-- Main Page Container -->
  <div class="page-container">

    <!-- For alternative headers START PASTE here -->

    <!-- A. HEADER -->      
    <div class="header">
      
      <!-- A.1 HEADER TOP -->
      <div class="header-top">
        
        <!-- Sitelogo and sitename -->
        <a class="sitelogo" href="index.php" title="home"></a>
        <div class="sitename">
          <h1><a href="index2.php" title="Home">GiveAway</a></h1>
        </div>
	

        <!-- Navigation Level 1 -->
        <div class="nav1">
          <ul>
            <li><a href="index2.php" title="Go to Start page">Home</a></li>
            <li><a href="contacto.php" >Cont&aacute;ctanos</a></li>
          </ul>
        </div>              
      </div>
      
      <!-- A.2 HEADER MIDDLE -->
      <div class="header-middle">    
   
        <!-- Site message -->
        <div class="sitemessage">
          <h1>COMPARTE</h1>
          <h2>Intercambio y donación de productos</h2>
          <h3><a href="#">&rsaquo;&rsaquo;&nbsp;M&aacute;s detalles</a></h3>
        </div>        
      </div>
      
      <!-- A.3 HEADER BOTTOM -->
      <div class="header-bottom">
      
        <!-- Navigation Level 2 (Drop-down menus) -->
        <div class="nav2">
	
          <!-- Navigation item -->
          <ul>
            <li><a href="index2.php">Home</a></li>
          </ul>
          
          <!-- Navigation item -->
          <ul>
            <li><a href="productos.php">Mis Productos</a></li>
          </ul>          

          <!-- Navigation item -->
          <ul>
            <li><a href="navegar.php">Productos Disponibles</a></li>
          </ul>
		<ul>
            <li><a href="perfil.php">Configuraci&oacute;n</a></li>
          </ul>
		  <ul>
            <li><a href="logout.php">Salir</a></li>
          </ul>
        </div>
	  </div>

      <!-- A.4 HEADER BREADCRUMBS -->

      <!-- Breadcrumbs -->
      <div class="header-breadcrumbs">

      </div>
    </div>

    <!-- For alternative headers END PASTE here -->

    <!-- B. MAIN -->
    <div class="main">
  
      <!-- B.1 MAIN CONTENT -->
      <div class="main-content">
        
        <!-- Pagetitle -->
        <h1 class="pagetitle">&Uacute;ltimos Productos</h1>

        <!-- Content unit - One column -->
        <div class="column1-unit">
          
		  <div id="gallery">
						<?php
							$p = new producto();
							$productos = $p->TopProductos();
												
							while($row = mysql_fetch_array($productos)){
									echo '<a><img src="imgs/'.$row['producto_imagen'].'" width="580" height="360" rel="<h3>'.$row['producto_nombre'].'</h3>'.$row['producto_descripcion'].'" /></a>';
							}
						?>
						<div class="caption"><div class="content"></div></div>
					</div>
		  
        </div>          
        <hr class="clear-contentunit" />
      </div>

      <!-- B.2 MAIN NAVIGATION -->
      <div class="main-navigation">

        <!-- Navigation Level 3 -->
        <div class="round-border-topleft"></div>
        <h1 class="first">Categor&iacute;as</h1>

        <!-- Navigation with grid style -->
        <dl class="nav3-grid">
          <dt><a href="categorias.php?cat=2">Libros</a></dt>
          <dt><a href="categorias.php?cat=1">Apuntes</a></dt>
          <dt><a href="categorias.php?cat=3">Otros</a></dt>
        </dl>                        
        <!-- Search form -->                  
        <h1>B&uacute;squeda R&aacute;pida</h1>
        <div class="searchform">
          <form action="quick.php" method="post">
            <fieldset>
              <input name="busqueda" class="field"  value=" Buscar..." />
              <input type="submit" name="button" class="button" value="GO!" />
            </fieldset>
          </form>

        </div>
  
      </div>                
    </div>
      
    <!-- C. FOOTER AREA -->      

    <div class="footer">
      <p>Copyright &copy; 2011 GiveAway | All Rights Reserved</p>
      <p class="credits">Design by <a href="http://www.1-2-3-4.info/" title="Designer Homepage">Wolfgang</a></p>
    </div>      
  </div> 
  
</body>
</html>



